package com.bt.lms.ui.action.teacher.basic.info;

import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

/**
 * 教师基本信息继续添加按钮事件
 */
public class TeacherInfoAddBtn implements EventHandler {


    private VBox dataVBox;
    private Integer width = 1280;
    private Integer height = 900;

    public TeacherInfoAddBtn(VBox dataVBox) {
        this.dataVBox = dataVBox;
    }

    @Override
    public void handle(Event event) {



        //保存按钮盒子
        HBox saveHBox = new HBox();
        saveHBox.setSpacing(20);
        saveHBox.setAlignment(Pos.CENTER_RIGHT);
        saveHBox.setPadding(new Insets(15,15,15,15));
        double saveHBoxHeight=height*0.01;
        saveHBox.setMaxHeight(saveHBoxHeight);
        saveHBox.setPrefWidth(width);
        Button savaBtn = new Button("保存");
        Button cancelBtn = new Button("取消");
        saveHBox.getChildren().addAll(savaBtn,cancelBtn);
        dataVBox.getChildren().add(saveHBox);


        //教师基本信息数据盒子
        HBox teacherInfoHBox = new HBox();
        teacherInfoHBox.setPadding(new Insets(15, 15, 15, 15));
        double teacherInfoVBoxHeight = height * 0.3;
        teacherInfoHBox.setMaxHeight(teacherInfoVBoxHeight);
        teacherInfoHBox.setPrefWidth(width);
        dataVBox.getChildren().add(teacherInfoHBox);


        //教师基本信息左数据盒子
        VBox teacherInfoLeftVBox = new VBox();
        teacherInfoLeftVBox.setSpacing(20);
        teacherInfoLeftVBox.setPadding(new Insets(15, 15, 15, 15));
        double teacherInfoLeftVBoxHeight = height * 0.3;
        teacherInfoLeftVBox.setMaxHeight(teacherInfoLeftVBoxHeight);
        teacherInfoLeftVBox.setPrefWidth(width * 0.5);
        teacherInfoHBox.getChildren().add(teacherInfoLeftVBox);

        //教师基本信息右数据盒子
        VBox teacherInfoRightVBox = new VBox();
        teacherInfoRightVBox.setSpacing(20);
        teacherInfoRightVBox.setPadding(new Insets(15, 15, 15, 15));
        double teacherInfoRightVBoxHeight = height * 0.3;
        teacherInfoRightVBox.setMaxHeight(teacherInfoRightVBoxHeight);
        teacherInfoRightVBox.setPrefWidth(width * 0.5);
        teacherInfoHBox.getChildren().add(teacherInfoRightVBox);

        //账号盒子
        HBox accountHBox = new HBox();
        accountHBox.setSpacing(20);
        double accountHBoxHeight = height * 0.05;
        accountHBox.setPrefHeight(accountHBoxHeight);
        accountHBox.setPrefWidth(width);
        Label accountLb = new Label("账号");
        accountLb.setPrefWidth(100);
        TextField accountTf = new TextField();
        accountHBox.getChildren().addAll(accountLb, accountTf);
        //证件类型盒子
        HBox certificateHBox = new HBox();
        certificateHBox.setSpacing(20);
        double certificateHBoxHeight = height * 0.05;
        certificateHBox.setPrefHeight(certificateHBoxHeight);
        certificateHBox.setPrefWidth(width);
        Label certificateLb = new Label("证件类型");
        certificateLb.setPrefWidth(100);
        TextField certificateTf = new TextField();
        certificateHBox.getChildren().addAll(certificateLb, certificateTf);
        //性别盒子
        HBox genderHBox = new HBox();
        genderHBox.setSpacing(20);
        double genderHBoxHeight = height * 0.05;
        genderHBox.setPrefHeight(genderHBoxHeight);
        genderHBox.setPrefWidth(width);
        Label genderLb = new Label("性别");
        genderLb.setPrefWidth(100);
        RadioButton genderRBtn1 = new RadioButton("男");
        RadioButton genderRBtn2 = new RadioButton("女");
        ToggleGroup toggleGroup = new ToggleGroup();
        toggleGroup.getToggles().addAll(genderRBtn1, genderRBtn2);
        genderHBox.getChildren().addAll(genderLb, genderRBtn1, genderRBtn2);
        //籍贯盒子
        HBox birthplaceHBox = new HBox();
        birthplaceHBox.setSpacing(20);
        double birthplaceHBoxHeight = height * 0.05;
        birthplaceHBox.setPrefHeight(birthplaceHBoxHeight);
        birthplaceHBox.setPrefWidth(width);
        Label birthplaceLb = new Label("籍贯");
        birthplaceLb.setPrefWidth(100);
        TextField birthplaceTf = new TextField();
        birthplaceHBox.getChildren().addAll(birthplaceLb, birthplaceTf);
        //政治面貌盒子
        HBox politicsStatusHBox = new HBox();
        politicsStatusHBox.setSpacing(20);
        double politicsStatusHBoxHeight = height * 0.05;
        politicsStatusHBox.setPrefHeight(politicsStatusHBoxHeight);
        politicsStatusHBox.setPrefWidth(width);
        Label politicsStatusLb = new Label("政治面貌");
        politicsStatusLb.setPrefWidth(100);
        ComboBox<String> politicsStatusCom = new ComboBox<>();
        politicsStatusCom.getSelectionModel().select("政治面貌");
        politicsStatusCom.getItems().add("党员");
        politicsStatusCom.getItems().add("团员");
        politicsStatusCom.getItems().add("群众");
        politicsStatusHBox.getChildren().addAll(politicsStatusLb, politicsStatusCom);
        //专业盒子
        HBox specialtyHBox = new HBox();
        specialtyHBox.setSpacing(20);
        double specialtyHBoxHeight = height * 0.05;
        specialtyHBox.setPrefHeight(specialtyHBoxHeight);
        specialtyHBox.setPrefWidth(width);
        Label specialtyLb = new Label("专业");
        specialtyLb.setPrefWidth(100);
        TextField specialtyTf = new TextField();
        specialtyHBox.getChildren().addAll(specialtyLb, specialtyTf);
        //最高学历盒子
        HBox educationHBox = new HBox();
        educationHBox.setSpacing(20);
        double educationHBoxHeight = height * 0.05;
        educationHBox.setPrefHeight(educationHBoxHeight);
        educationHBox.setPrefWidth(width);
        Label educationLb = new Label("最高学历");
        educationLb.setPrefWidth(100);
        ComboBox<String> educationCom = new ComboBox<>();
        educationCom.getSelectionModel().select("选择学历");
        educationCom.getItems().add("博士");
        educationCom.getItems().add("硕士");
        educationCom.getItems().add("本科");
        educationCom.getItems().add("荣誉博士");
        educationHBox.getChildren().addAll(educationLb, educationCom);
        //移动电话盒子
        HBox movePhoneHBox = new HBox();
        movePhoneHBox.setSpacing(20);
        double movePhoneHBoxHeight = height * 0.05;
        movePhoneHBox.setPrefHeight(movePhoneHBoxHeight);
        movePhoneHBox.setPrefWidth(width);
        Label movePhoneLb = new Label("移动电话");
        movePhoneLb.setPrefWidth(100);
        TextField movePhoneTf = new TextField();
        movePhoneHBox.getChildren().addAll(movePhoneLb, movePhoneTf);
        teacherInfoLeftVBox.getChildren().addAll(accountHBox, certificateHBox, genderHBox, birthplaceHBox, politicsStatusHBox, specialtyHBox, educationHBox, movePhoneHBox);


        //姓名盒子
        HBox nameHBox = new HBox();
        nameHBox.setSpacing(20);
        double nameHBoxHeight = height * 0.05;
        nameHBox.setPrefHeight(nameHBoxHeight);
        nameHBox.setPrefWidth(width);
        Label nameLb = new Label("姓名");
        nameLb.setPrefWidth(100);
        TextField nameTf = new TextField();
        nameHBox.getChildren().addAll(nameLb, nameTf);
        //证件号码盒子
        HBox certificateNumberHBox = new HBox();
        certificateNumberHBox.setSpacing(20);
        double certificateNumberHBoxHeight = height * 0.05;
        certificateNumberHBox.setPrefHeight(certificateNumberHBoxHeight);
        certificateNumberHBox.setPrefWidth(width);
        Label certificateNumberLb = new Label("证件号码");
        certificateNumberLb.setPrefWidth(100);
        TextField certificateNumberTf = new TextField();
        certificateNumberHBox.getChildren().addAll(certificateNumberLb, certificateNumberTf);
        //出生日期盒子
        HBox birthdateHBox = new HBox();
        birthdateHBox.setSpacing(20);
        double birthdateHBoxHeight = height * 0.05;
        birthdateHBox.setPrefHeight(birthdateHBoxHeight);
        birthdateHBox.setPrefWidth(width);
        Label birthdateLb = new Label("出生日期");
        birthdateLb.setPrefWidth(100);
        DatePicker birthdateDP = new DatePicker();
        birthdateHBox.getChildren().addAll(birthdateLb, birthdateDP);
        //民族盒子
        HBox nationHBox = new HBox();
        nationHBox.setSpacing(20);
        double nationHBoxHeight = height * 0.05;
        nationHBox.setPrefHeight(nationHBoxHeight);
        nationHBox.setPrefWidth(width);
        Label nationLb = new Label("民族");
        nationLb.setPrefWidth(100);
        TextField nationTf = new TextField();
        nationHBox.getChildren().addAll(nationLb, nationTf);
        //所属单位盒子
        HBox unitHBox = new HBox();
        unitHBox.setSpacing(20);
        double unitHBoxHeight = height * 0.05;
        unitHBox.setPrefHeight(unitHBoxHeight);
        unitHBox.setPrefWidth(width);
        Label unitLb = new Label("所属单位");
        unitLb.setPrefWidth(100);
        ComboBox<String> unitCom = new ComboBox<>();
        unitCom.getSelectionModel().select("选择所属单位");
        unitCom.getItems().add("北京师范大学");
        unitCom.getItems().add("东北师范大学");
        unitCom.getItems().add("西南大学");
        unitHBox.getChildren().addAll(unitLb, unitCom);
        //职称盒子
        HBox rankHBox = new HBox();
        rankHBox.setSpacing(20);
        double rankHBoxHeight = height * 0.05;
        rankHBox.setPrefHeight(rankHBoxHeight);
        rankHBox.setPrefWidth(width);
        Label rankLb = new Label("职称");
        rankLb.setPrefWidth(100);
        TextField rankTf = new TextField();
        rankHBox.getChildren().addAll(rankLb, rankTf);
        //教龄盒子
        HBox seniorityHBox = new HBox();
        seniorityHBox.setSpacing(20);
        double seniorityHBoxHeight = height * 0.05;
        seniorityHBox.setPrefHeight(seniorityHBoxHeight);
        seniorityHBox.setPrefWidth(width);
        Label seniorityLb = new Label("教龄");
        seniorityLb.setPrefWidth(100);
        TextField seniorityTf = new TextField();
        seniorityHBox.getChildren().addAll(seniorityLb, seniorityTf);
        //电话盒子
        HBox phoneHBox = new HBox();
        phoneHBox.setSpacing(20);
        double phoneHBoxHeight = height * 0.05;
        phoneHBox.setPrefHeight(phoneHBoxHeight);
        phoneHBox.setPrefWidth(width);
        Label phoneLb = new Label("联系电话");
        phoneLb.setPrefWidth(100);
        TextField phoneTf = new TextField();
        phoneHBox.getChildren().addAll(phoneLb, phoneTf);
        teacherInfoRightVBox.getChildren().addAll(nameHBox, certificateNumberHBox, birthdateHBox, nationHBox, unitHBox, rankHBox, seniorityHBox, phoneHBox);


        //研究方向盒子
        HBox outcomeHBox = new HBox();
        outcomeHBox.setSpacing(20);
        outcomeHBox.setAlignment(Pos.CENTER_LEFT);
        outcomeHBox.setPadding(new Insets(0, 0, 0, 30));
        double outcomeHBoxHeight = height * 0.1;
        outcomeHBox.setPrefHeight(outcomeHBoxHeight);
        outcomeHBox.setPrefWidth(width);
        Label outcomeLb = new Label("研究方向及成果");
        outcomeLb.setPrefWidth(100);
        TextArea outcomeTa = new TextArea();
        outcomeHBox.getChildren().addAll(outcomeLb, outcomeTa);
        dataVBox.getChildren().add(outcomeHBox);

        //照片盒子
        HBox pictureHBox = new HBox();
        pictureHBox.setAlignment(Pos.CENTER_LEFT);
        pictureHBox.setPadding(new Insets(20, 0, 0, 30));
        pictureHBox.setSpacing(20);
        double pictureHBoxHeight = height * 0.1;
        pictureHBox.setPrefHeight(pictureHBoxHeight);
        pictureHBox.setPrefWidth(width);
        Label pictureLb = new Label("照片");
        pictureLb.setPrefWidth(100);
        TextField pictureTF = new TextField();
        Button selectBtn = new Button("选择文件");
        Button putBtn = new Button("上传");
        pictureHBox.getChildren().addAll(pictureLb, pictureTF, selectBtn, putBtn);
        dataVBox.getChildren().add(pictureHBox);

    }
}